import TileLayer from 'ol/layer/Tile'
import {
    OSM,
    XYZ,
    TileArcGISRest
} from 'ol/source'
const maptype = 0
// 0 表示部署的离线瓦片地图，1表示OSM, 2表示使用Arcgis在线午夜蓝地图服务
const streetmap = function () {
    let maplayer = null
    switch (maptype) {
        case 0:
            maplayer = new TileLayer({
                title: '离线矢量瓦片',
                // className: 'blueLayer',
                source: new XYZ({
                    maxZoom: 18,
                    // url: '/tiles/{z}/{x}/{y}/tile.png' //本地瓦片
                    // url: './mappng/{z}/{x}/{y}/tile.png' //本地瓦片
                    // url: 'https://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}',   // 地信通在线瓦片
                    url: 'http://10.15.40.252:5557/gisproxy/RasterServer/hhhtvec/{z}/{x}/{y}?tk=6667c355-71bc-11ec-b687-0242ac110002',   // 地信通离线瓦片
                    // url: 'http://webst0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}',  // 高德瓦片
                }),
                visible: true,
                preload: 9,
            })
            break
        case 1:
            maplayer = new TileLayer({
                source: new OSM()
            })
            break
        case 2:
            maplayer = new TileLayer({
                source: new TileArcGISRest({
                    url: 'https://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer'
                })
            })
            break
    }
    return [maplayer]
}
const mapconfig = {
    streetmap: streetmap
}
export default mapconfig
